//工具类：文件上传、导出表格等
const multer = require("multer"); //文件上传中间件：
var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, './public/uploads')
  },
  //   destination：该文件要保存的文件夹,直接存储了。
  // filename：在保存的文件夹下的文件名
  filename: function (req, file, cb) {
    var fileFormat = (file.originalname).split(".");
    cb(null, file.fieldname + "-" + Date.now() + "." + fileFormat[fileFormat.length - 1]);
  }
})
var upload = multer({
  storage: storage
})
// const upload = multer({ dest: "uploads/" });
const fs = require("fs");
const express = require("express");
const router = express.Router();
const db = require('./../db/config')

module.exports = router;